#include "ht_def.h"
#include "tcsapi/tcs_error.h"
#include "tcfapi/tcf_error.h"
#include "tcsapi/tcs_tpcm_error.h"

ht_err_t ht_g_err[] = {
	{ HTTC_ERR_NONE,			"none"},
	{ HTTC_EXIT,				"退出程序信号"},
	{ HTTC_RELOAD,				"重新加载信号"},
	{ HTTC_ERR_BUSY,			"业务繁忙"},
	{ HTTC_ERR_COMMON,			"一般错误"},
	/*-250*/
	{ HTTC_ERR_CMD_NOT_SUPPORT,		"命令不支持"},
	{ HTTC_ERR_MODULE_NOT_FOUND,		"模块未加载"},
	{ HTTC_ERR_HAS_REGISTER,		"已注册"},
	{ HTTC_ERR_TCF,				"TCF接口调用错误"},
	{ HTTC_ERR_SQLITE,			"sqlite数据库错误"},
	{ HTTC_ERR_NVWRITE,			"NV区域写错误"},
	{ HTTC_ERR_NVREAD,			"NV区域读错误"},
	{ HTTC_ERR_PATH,			"文件路径不存在"},
	{ HTTC_ERR_PATH_SIZE,			"文件大小错误"},
	{ HTTC_ERR_NOMEM,			"内存错误"},
	/*-240*/
	{ HTTC_ERR_DATA,			"数据包数据错误"},
	{ HTTC_ERR_TIMEOUT,			"连接/接收超时"},
	{ HTTC_ERR_CONNECT,			"连接失败"},
	{ HTTC_ERR_PACKET,			"数据包格式错误"},
	{ HTTC_ERR_CONFIG,			"配置错误"},
	{ HTTC_ERR_INIT,			"初始化失败"},
	{ HTTC_ERR_LIMIT,			"资源不足"},
	{ HTTC_ERR_REGISTER,			"注册失败"},
	{ HTTC_ERR_STATE,			"状态不匹配"},
	{ HTTC_ERR_DOWNLOAD,			"下载失败"},
	/*-230*/
	{ HTTC_ERR_TCF_ARG,			"TCF接口参数错误"},
	{ HTTC_OK,				"success"},

	/*TPCM错误码*/
	/*128*/
	{ TPCM_MEASURE_FAIL,			"度量失败，通常用在度量结果表示上"},
	{ TPCM_BADTAG,				"命令对应的头部信息错误"},
	{ TPCM_NOMEM,				"用于申请内存时，内存不够而产生的错误"},
	{ TPCM_LOAD_ERROR,			"数据加载失败，通常用在数据获取或拷贝上"},
	{ TPCM_SERIALIZE_ERROR,			"flash在进行串行化数据失败"},
	{ TPCM_INVALID_COMMAND,			"TPCM不支持的命令码，即TPCM无法处理该命令"},
	{ TPCM_BAD_PARAMETER,			"TPCM在解析命令参数时发生的错误，一般为参数不合法"},
	{ TPCM_BAD_PARAM_SIZE,			"命令的传入参数对应的实际大小跟标明的参数大小不同导致的错误"},
	{ TPCM_NOSPACE,				"主要是数据结构中没有对应的项或者超出了结构保存的最大数据量"},
	{ TPCM_LOG_ERROR,			"TPCM日志错误"},
	{ TPCM_OUT_SIZE_EXCEEDED,		"需要存储的内容超过了规定的最大限制"},
	{ TPCM_KEY_ISNULL,			"搜索不到key"},
	/*140*/
	{ TPCM_NO_ENTITY,			"读取的数据不存在"},
	{ TPCM_VERSION_INVERSED,		"系统更新的时候版本比原来的版本还低而产生的错误码"},
	{ TPCM_MAP_FAIL,			"内存映射失败导致的错误"},
	{ TPCM_VERIFY_FAIL,			"验证数据时不匹配而导致的错误（验签失败）"},
	{ TPCM_VERIFY_REPLAY,			"重放已经执行的命令导致的错误码"},
	{ TPCM_SIZE_EXCEEDED,			"所需要的空间超过最大可保存容量"},
	{ TPCM_LICENSE_INVALID,			"无效的license"},
	{ TPCM_LICENSE_EXPIRED,			"失效，过期了的license"},
	{ TPCM_FLASH_WRITE_ERROR,		"Flash写失败"},
	{ TPCM_FLASH_READ_ERROR,		"Flash 读取失败"},
	/*150*/
	{ TPCM_FLASH_ERASE_ERROR,		"Flash 擦除过程失败"},
	{ TPCM_UNSUPPORTED_FEATURE,		"TPCM不支持的特性导致的错误"},
	{ TPCM_DUPLICATED_DATA,			"重复数据，如下载的白名单全部都已存在。"},
	{ TPCM_SIGN_FAILED,			"签名失败"},
	{ TPCM_SM3_ERROR,			"SM3计算失败"},
	{ TPCM_RESTORE_FAILED,			"数据恢复失败"},
	{ TPCM_RESTORE_DEFAULTS,		"License重置失败"},
	{ TPCM_LICENSE_TYPE_ERROR,		"license类型错误"},
	{ TPCM_SET_SYSTIME_ERROR,		"系统时间设置错误"},
	{ TPCM_BAD_PARATYPE,			"配置参数类型不对"},
	/*160*/
	{ TPCM_ADMIN_CERT_NONE,			"没有认证证书"},
	{ TPCM_ADMIN_AUTH_FAIL,			"认证失败"},
	{ TPCM_NO_SECOND_CERT_FAIL,		"没有二级证书"},
	{ TPCM_SET_POLICY_AUTH_ERROR,		"策略认证目标或者认证参数为空"},
	{ TPCM_BAD_AUTH_TYPE,			"认证类型错误，非0和1"},
	{ TPCM_SET_GLOBAL_AUTH_FAIL,		"设置全局策略认证失败"},
	{ TPCM_PASSWORD_AUTH_ERROR,		"口令认证失败"},
	{ TPCM_SM4_ENCRY_ERROR,			"SM4加密失败"},
	{ TPCM_PCR_TYPR_ERROR,			"指定的PCR类性/PCR索引错误"},
	{ TPCM_AUTH_UID_NULL,			"认证UID为空"},
	/*170*/
	{ TPCM_AUTH_NOT_MATCH_SECOND_CERT,	"证书不匹配"},
	{ TPCM_AUTH_FLAG_NO_TRUST,		"认证标识不可信"},
	{ TPCM_AUTH_POLICY_HASH_NO_MATCH,	"策略认证hash不匹配"},
	{ TPCM_INVALID_ACTION,			"非法动作操作"},
	{ TPCM_RANDOM_GENERATE_FAILED,		"随机数生成失败"},
	{ TPCM_SM2_ENCRY_ERROR,			"SM2加密失败"},
	{ TPCM_AUTH_POLICY_FLAG_ERROR,		"认证策路flag项错误"},
	{ TPCM_SM2_VERIFY_ERROR,		"SM2验签失败"},
	{ TPCM_SEND_TO_PHYSICAL_ERROR,		"TPCM与TCM通信失败"},
	{ TPCM_GET_TCM_INFO_ERROR,		"TPCM获取TCM信息失败"},
	/*180*/
	{ TPCM_NV_NO_RECORD,			"预留"},
	{ TPCM_POLICES_NUM_ERROR,		"策略数错误"},
	{ TPCM_AUTH_POLICY_ID_REPEAT,		"管理认证策略输入参数策略id冲突"},
	{ TPCM_ID_VERIFY_FAIL,			"Tpcm id 验证失败"},
	{ TPCM_PLOCY_OBJECT_ID_ERROR,		"策略目标错误"},
	{ TPCM_PLOCY_AUTH_TYPE_ERROR,		"策略认证类型"},

	/* 平台SYS错误码 */
	{ TPCM_ERROR_UNSUPPORTED_CMD_TYPE, 	"不支持的命令类型"},
	{ TPCM_ERROR_INVALID_COMMAND,		"无效命令号"},
	{ TPCM_ERROR_MAP_FAIL,			"映射失败"},
	{ TPCM_ERROR_NO_SPACE,			"命令队列空间已满"},
	{ TPCM_ERROR_INVALID_PARAM,		"无效参数"},

	/*TDD错误码*/
	{ TPCM_ERROR_TIMEOUT,			"命令接收超时"},
	{ TPCM_ERROR_CATEGORY_MISMATCH,		"命令类别不支持"},
	{ TPCM_ERROR_NOMEM,			"没有内存"},
	{ TPCM_ERROR_SEND_FAIL,			"命令发送失败"},
	{ TPCM_ERROR_EXCEED,			"缓冲区空间不足"},

	/*TCS错误码*/
	{ TSS_ERR_BAD_ARGS,			"非法参数"},
	{ TSS_ERR_NOMEM,			"内存不足"},
	{ TSS_ERR_IO,				"数据传输出错"},
	{ TSS_ERR_INPUT_EXCEED,			"传入参数超过TSS可接收上限"},
	{ TSS_ERR_OUTPUT_EXCEED,		"传出数据超过传出参数可接收上限"},
	{ TSS_ERR_ITEM_NOT_FOUND,		"未找到对应表项"},
	/*1030*/
	{ TSS_ERR_BAD_RESPONSE,			"非法的response数据流"},
	{ TSS_ERR_BAD_RESPONSE_TAG,		"非法的response TAG标识"},
	{ TSS_ERR_DEV_OPEN,			"打开设备文件失败"},
	{ TSS_ERR_MAP,				"映射失败"},
	{ TSS_ERR_FILE,				"创建或者打开文件失败"},
	{ TSS_ERR_READ,				"读文件失败"},
	{ TSS_ERR_WRITE,			"写文件失败"},
	{ TSS_ERR_RECREATE,			"重复创建"},
	{ TSS_ERR_SHELL,			"执行shell失败"},
	{ TSS_ERR_NOT_SUPPORT,			"不支持的操作"},
	/*1040*/
	{ TSS_ERR_RAND,				"创建随机数失败"},
	{ TSS_ERR_DIR,				"目录操作失败"},
	{ TSS_ERR_VERIFY,			"验证失败"},
	{ TSS_ERR_NONCE,			"Nonce不匹配"},
	{ TSS_ERR_UNTRUSTED,			"不可信的系统环境"},
	{ TSS_ERR_ADMIN_AUTH,			"TSB授权检查错误"},
	{ TSS_ERR_TSB,				"调用TSB接口返回错误"},
	{ TSS_ERR_SEM,				"信号量错误"},

	/*TCF错误码*/
	{ TCF_ERR_PARAMETER,			"非法参数"},
	{ TCF_ERR_DIR,				"非法路径"},
	{ TCF_ERR_FILE,				"文件操作失败"},
	{ TCF_ERR_NOMEM,			"内存不足"},
	/*4100*/
	{ TCF_ERR_BAD_DATA,			"返回参数非法"},
	{ TCF_ERR_TIME,				"获取当前系统时间出错"},
	{ TCF_ERR_TIMEOUT,			"超时"},
	{ TCF_ERR_ITEM_NOT_FOUND,		"未找到对应表项"},
	{ TCF_ERR_INPUT_EXCEED,			"传入参数超过TSS可接收上限"},
	{ TCF_ERR_OUTPUT_EXCEED,		"传出数据超过传出参数可接收上限"},
	{ TCF_ERR_RAND,				"创建随机数失败"},
	{ TCF_ERR_TSB,				"调用TSB接口返回错误"},
	{ TCF_ERR_SEM,				"信号量获取失败"},
	{ TCF_ERR_SELECT,			"监听失败"},
	/*4110*/
	{ TCF_ERR_VERSION,			"版本号错误"},
};

